package com.education.welco.service.impl;


import com.education.common.utils.Convert;
import com.education.welco.mapper.LCatalogUserMapper;
import com.education.welco.pojo.LCatalogUser;
import com.education.welco.service.ILCatalogUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户课程关联 服务层实现
 *
 * @author d
 * @date 2020-05-12
 */
@Service
public class LCatalogUserServiceImpl implements ILCatalogUserService {

    @Autowired
    private LCatalogUserMapper lCatalogUserMapper;

    /**
     * 查询用户课程关联信息
     *
     * @param id 用户课程关联ID
     * @return 用户课程关联信息
     */
    @Override
    public LCatalogUser selectLCatalogUserById(Integer id) {
        return lCatalogUserMapper.selectLCatalogUserById(id);
    }

    /**
     * 查询用户课程关联列表
     *
     * @param lCatalogUser 用户课程关联信息
     * @return 用户课程关联集合
     */
    @Override
    public List<LCatalogUser> selectLCatalogUserList(LCatalogUser lCatalogUser) {
        return lCatalogUserMapper.selectLCatalogUserList(lCatalogUser);
    }

    /**
     * 新增用户课程关联
     *
     * @param lCatalogUser 用户课程关联信息
     * @return 结果
     */
    @Override
    public int insertLCatalogUser(LCatalogUser lCatalogUser) {
        return lCatalogUserMapper.insertLCatalogUser(lCatalogUser);
    }

    /**
     * 修改用户课程关联
     *
     * @param lCatalogUser 用户课程关联信息
     * @return 结果
     */
    @Override
    public int updateLCatalogUser(LCatalogUser lCatalogUser) {
        return lCatalogUserMapper.updateLCatalogUser(lCatalogUser);
    }

    /**
     * 删除用户课程关联对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteLCatalogUserByIds(String ids) {
        return lCatalogUserMapper.deleteLCatalogUserByIds(Convert.toStrArray(ids));
    }

    @Override
    public int deleteLCatalogUserByCatalogIdAndUserId(Integer catalogId, Integer userId) {
        return lCatalogUserMapper.deleteLCatalogUserByCatalogIdAndUserId(catalogId,userId);
    }
}